package com.gitee.vueantd.upload.domain;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.util.Date;

@Getter
@Setter
@ToString
@NoArgsConstructor
@Entity
@Table(name = "upload_chunk", indexes = {
        @Index(name = "idx_upload_chunk_chunk_index", columnList = "chunk_index"),
        @Index(name = "idx_upload_chunk_chunk_size", columnList = "chunk_size"),
        @Index(name = "idx_upload_chunk_node_id", columnList = "node_id"),
        @Index(name = "idx_upload_chunk_file_size", columnList = "file_size"),
        @Index(name = "idx_upload_chunk_file_type", columnList = "file_type"),
        @Index(name = "idx_upload_chunk_file_hash", columnList = "file_hash"),
})
public class UploadChunk {
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Id
  @Column(name = "id")
  private Long id;

  @Column(name = "file_hash")
  private String fileHash;

  @Column(name = "file_type")
  private Integer fileType;

  @Column(name = "chunk_index")
  private Long chunkIndex;

  @Column(name = "chunk_size")
  private Long chunkSize;

  @Column(name = "total_chunks")
  private Long totalChunks;

  @Column(name = "node_id")
  private Long nodeId;

  @Column(name = "file_size")
  private Long fileSize;

  @Column(name = "modify_time")
  private Long modifyTime;

  @Column(name = "file_name")
  private String fileName;

  @Column(name = "user_name")
  private String userName;

  @Column(name = "chunk_hash")
  private String chunkHash;

  @Column(name = "create_time")
  private Date createTime = new Date();
}
